home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / 4D / ComboBox 1.1.1 / src / ComboBoxCmds.c < prev    next >
Text File  |  1996-02-23  |  18KB  |  647 lines

  1. //---------------------------------------------------------------------------------------
  2. //
  3. //    ComboBoxCmds.c -- Source for ComboBox external area's supporting commands
  4. //
  5. //    Copyright ©1995-1996, Pensacola Christian College
  6. //
  7. //    ======================================================================
  8. //    Change History
  9. //    ======================================================================
  10. //
  11. //    1.0            08/  /95        Steve Dwire
  12. //                                            Initial release
  13. //
  14. //---------------------------------------------------------------------------------------
  15.  
  16. #include <Ext4D.h>
  17. #include "ComboBoxMain.h" // Include your header here.
  18.  
  19.  
  20. //---------------------------------------------------------------------------------
  21. //
  22. // FUNCTION: CB_SetDefTxtFnt
  23. //
  24. //---------------------------------------------------------------------------------
  25.  
  26. void CB_SetDefTxtFnt(PackHnd PackDataHnd, SWORD FontNum, SWORD FontSize, SWORD FontStyle)
  27. {
  28.     (*PackDataHnd)->DefTextFont = FontNum;
  29.     (*PackDataHnd)->DefTextSize = FontSize;
  30.     (*PackDataHnd)->DefTextStyle = FontStyle;
  31. }
  32.  
  33.  
  34. //---------------------------------------------------------------------------------
  35. //
  36. // FUNCTION: CB_SetDefTxtCol
  37. //
  38. //---------------------------------------------------------------------------------
  39.  
  40. void CB_SetDefTxtCol(PackHnd PackDataHnd, SWORD ForeColor, SWORD BackColor)
  41. {
  42.     (*PackDataHnd)->DefTextFGColor = ForeColor;
  43.     (*PackDataHnd)->DefTextBGColor = BackColor;
  44. }
  45.  
  46.  
  47. //---------------------------------------------------------------------------------
  48. //
  49. // FUNCTION: CB_SetDefLstFnt
  50. //
  51. //---------------------------------------------------------------------------------
  52.  
  53. void CB_SetDefLstFnt(PackHnd PackDataHnd, SWORD FontNum, SWORD FontSize, SWORD FontStyle)
  54. {
  55.     (*PackDataHnd)->DefListFont = FontNum;
  56.     (*PackDataHnd)->DefListSize = FontSize;
  57.     (*PackDataHnd)->DefListStyle = FontStyle;
  58. }
  59.  
  60.  
  61. //---------------------------------------------------------------------------------
  62. //
  63. // FUNCTION: CB_SetDefLstCol
  64. //
  65. //---------------------------------------------------------------------------------
  66.  
  67. void CB_SetDefLstCol(PackHnd PackDataHnd, SWORD ForeColor, SWORD BackColor)
  68. {
  69.     (*PackDataHnd)->DefListFGColor = ForeColor;
  70.     (*PackDataHnd)->DefListBGColor = BackColor;
  71. }
  72.  
  73.  
  74. //---------------------------------------------------------------------------------
  75. //
  76. // FUNCTION: CB_SetDefLstRws
  77. //
  78. //---------------------------------------------------------------------------------
  79.  
  80. void CB_SetDefLstRws(PackHnd PackDataHnd, SWORD Rows)
  81. {
  82.     (*PackDataHnd)->DefListRows = Rows;
  83. }
  84.  
  85.  
  86. //---------------------------------------------------------------------------------
  87. //
  88. // FUNCTION: CB_SetDefPopPic
  89. //
  90. //---------------------------------------------------------------------------------
  91.  
  92. void CB_SetDefPopPic(PackHnd PackDataHnd, SWORD CUp, SWORD CDown, SWORD CDis, SWORD MUp, SWORD MDown, SWORD MDis)
  93. {
  94.     (*PackDataHnd)->DefCPICTResUp = CUp;
  95.     (*PackDataHnd)->DefCPICTResDn = CDown;
  96.     (*PackDataHnd)->DefCPICTResDis = CDis;
  97.     (*PackDataHnd)->DefMPICTResUp = MUp;
  98.     (*PackDataHnd)->DefMPICTResDn = MDown;
  99.     (*PackDataHnd)->DefMPICTResDis = MDis;
  100. }
  101.  
  102.  
  103. //---------------------------------------------------------------------------------
  104. //
  105. // FUNCTION: CB_SetDefGap
  106. //
  107. //---------------------------------------------------------------------------------
  108.  
  109. void CB_SetDefGap(PackHnd PackDataHnd, SWORD Pict, SWORD Top, SWORD Left, SWORD Right)
  110. {
  111.     (*PackDataHnd)->DefPixGap = Pict;
  112.     (*PackDataHnd)->DefTopGap = Top;
  113.     (*PackDataHnd)->DefLeftGap = Left;
  114.     (*PackDataHnd)->DefRightGap = Right;
  115. }
  116.  
  117.  
  118. //---------------------------------------------------------------------------------
  119. //
  120. // FUNCTION: CB_SetDefLead
  121. //
  122. //---------------------------------------------------------------------------------
  123.  
  124. void CB_SetDefLead(PackHnd PackDataHnd, SWORD Lead)
  125. {
  126.     (*PackDataHnd)->DefPixLead = Lead;
  127. }
  128.  
  129.  
  130. //---------------------------------------------------------------------------------
  131. //
  132. // FUNCTION: CB_SetDefFlags
  133. //
  134. //---------------------------------------------------------------------------------
  135.  
  136. void CB_SetDefFlags(PackHnd PackDataHnd, SWORD CanFind, SWORD CanFill, SWORD CanList, SWORD CanEdit, SWORD ListOnActivate, SWORD ListOnKeystroke)
  137. {
  138.     (*PackDataHnd)->DefFlags.CanFind = (CanFind != 0);
  139.     (*PackDataHnd)->DefFlags.CanFill = (CanFill != 0);
  140.     (*PackDataHnd)->DefFlags.CanList = ((CanList || ListOnActivate || ListOnKeystroke) != 0);
  141.     (*PackDataHnd)->DefFlags.CanEdit = (CanEdit != 0);
  142.     (*PackDataHnd)->DefFlags.ListOnActivate = (ListOnActivate != 0);
  143.     (*PackDataHnd)->DefFlags.ListOnKeystroke = (ListOnKeystroke != 0);
  144.  
  145.  
  146. //---------------------------------------------------------------------------------
  147. //
  148. // FUNCTION: CB_SetTxtFnt
  149. //
  150. //---------------------------------------------------------------------------------
  151.  
  152. void CB_SetTxtFnt(AreaHnd AreaDataHnd, SWORD FontNum, SWORD FontSize, SWORD FontStyle)
  153. {
  154.     TEHandle    text;
  155.     
  156.     (*AreaDataHnd)->TextFont = FontNum;
  157.     (*AreaDataHnd)->TextSize = FontSize;
  158.     (*AreaDataHnd)->TextStyle = FontStyle;
  159.     
  160.     text = (*AreaDataHnd)->TextTEHnd;
  161.     (*text)->txFont = FontNum;
  162.     (*text)->txSize = FontSize;
  163.     (*text)->txFace = FontStyle;
  164.     
  165.     InvalRect(&((*AreaDataHnd)->AreaRect));
  166. }
  167.  
  168.  
  169. //---------------------------------------------------------------------------------
  170. //
  171. // FUNCTION: CB_SetTxtCol
  172. //
  173. //---------------------------------------------------------------------------------
  174.  
  175. void CB_SetTxtCol(AreaHnd AreaDataHnd, SWORD ForeColor, SWORD BackColor)
  176. {
  177.     (*AreaDataHnd)->TextFGColor = ForeColor;
  178.     (*AreaDataHnd)->TextBGColor = BackColor;
  179.     InvalRect(&((*AreaDataHnd)->AreaRect));
  180. }
  181.  
  182.  
  183. //---------------------------------------------------------------------------------
  184. //
  185. // FUNCTION: CB_SetLstFnt
  186. //
  187. //---------------------------------------------------------------------------------
  188.  
  189. void CB_SetLstFnt(AreaHnd AreaDataHnd, SWORD FontNum, SWORD FontSize, SWORD FontStyle)
  190. {
  191.     AreaPtr    AreaDataPtr;
  192.     
  193.     HLock((Handle)AreaDataHnd);
  194.     AreaDataPtr = *AreaDataHnd;
  195.  
  196.     AreaDataPtr->ListFont = FontNum;
  197.     AreaDataPtr->ListSize = FontSize;
  198.     AreaDataPtr->ListStyle = FontStyle;
  199.     RedrawList(AreaDataPtr);
  200.     HUnlock((Handle)AreaDataHnd);
  201. }
  202.  
  203.  
  204. //---------------------------------------------------------------------------------
  205. //
  206. // FUNCTION: CB_SetLstCol
  207. //
  208. //---------------------------------------------------------------------------------
  209.  
  210. void CB_SetLstCol(AreaHnd AreaDataHnd, SWORD ForeColor, SWORD BackColor)
  211. {
  212.     AreaPtr    AreaDataPtr;
  213.     
  214.     HLock((Handle)AreaDataHnd);
  215.     AreaDataPtr = *AreaDataHnd;
  216.  
  217.     AreaDataPtr->ListFGColor = ForeColor;
  218.     AreaDataPtr->ListBGColor = BackColor;
  219.     RedrawList(AreaDataPtr);
  220.     HUnlock((Handle)AreaDataHnd);
  221. }
  222.  
  223.  
  224. //---------------------------------------------------------------------------------
  225. //
  226. // FUNCTION: CB_SetLstRws
  227. //
  228. //---------------------------------------------------------------------------------
  229.  
  230. void CB_SetLstRws(AreaHnd AreaDataHnd, SWORD Rows)
  231. {
  232.     AreaPtr    AreaDataPtr;
  233.     
  234.     HLock((Handle)AreaDataHnd);
  235.     AreaDataPtr = *AreaDataHnd;
  236.  
  237.     AreaDataPtr->ListRows = Rows;
  238.     CalcListRect(AreaDataPtr);
  239.     //••••• RESIZE THE WINDOW IF IT'S OPEN
  240.     RedrawList(AreaDataPtr);
  241.     HUnlock((Handle)AreaDataHnd);
  242. }
  243.  
  244.  
  245. //---------------------------------------------------------------------------------
  246. //
  247. // FUNCTION: CB_GetLstRws
  248. //
  249. //---------------------------------------------------------------------------------
  250.  
  251. SLONG CB_GetLstRws(AreaHnd AreaDataHnd)
  252. {
  253.     return (*AreaDataHnd)->ListRows;
  254. }
  255.  
  256.  
  257. //---------------------------------------------------------------------------------
  258. //
  259. // FUNCTION: CB_SetPopPic
  260. //
  261. //---------------------------------------------------------------------------------
  262.  
  263. void CB_SetPopPic(AreaHnd AreaDataHnd, SWORD CUp, SWORD CDown, SWORD CDis, SWORD MUp, SWORD MDown, SWORD MDis)
  264. {
  265.     AreaPtr    AreaDataPtr;
  266.     
  267.     HLock((Handle)AreaDataHnd);
  268.     AreaDataPtr = *AreaDataHnd;
  269.  
  270.     AreaDataPtr->CPICTResUp = CUp;
  271.     AreaDataPtr->CPICTResDn = CDown;
  272.     AreaDataPtr->CPICTResDis = CDis;
  273.     AreaDataPtr->MPICTResUp = MUp;
  274.     AreaDataPtr->MPICTResDn = MDown;
  275.     AreaDataPtr->MPICTResDis = MDis;
  276.     InitAreaPICT(AreaDataPtr);
  277.     CalcTextRect(AreaDataPtr);
  278.     InvalRect(&(AreaDataPtr->AreaRect));
  279.     HUnlock((Handle)AreaDataHnd);
  280. }
  281.  
  282.  
  283. //---------------------------------------------------------------------------------
  284. //
  285. // FUNCTION: CB_SetGap
  286. //
  287. //---------------------------------------------------------------------------------
  288.  
  289. void CB_SetGap(AreaHnd AreaDataHnd, SWORD Pict, SWORD Top, SWORD Left, SWORD Right)
  290. {
  291.     AreaPtr    AreaDataPtr;
  292.  
  293.     HLock((Handle)AreaDataHnd);
  294.     AreaDataPtr = *AreaDataHnd;
  295.     
  296.     AreaDataPtr->PixGap = Pict;
  297.     AreaDataPtr->TopGap = Top;
  298.     AreaDataPtr->LeftGap = Left;
  299.     AreaDataPtr->RightGap = Right;
  300.     CalcTextRect(AreaDataPtr);
  301.     CalcListRect(AreaDataPtr);
  302.     InvalRect(&(AreaDataPtr->AreaRect));
  303.     HUnlock((Handle)AreaDataHnd);
  304. }
  305.  
  306.  
  307. //---------------------------------------------------------------------------------
  308. //
  309. // FUNCTION: CB_SetLead
  310. //
  311. //---------------------------------------------------------------------------------
  312.  
  313. void CB_SetLead(AreaHnd AreaDataHnd, SWORD Lead)
  314. {
  315.     (*AreaDataHnd)->PixLead = Lead;
  316.     HLock((Handle)AreaDataHnd);
  317.     CalcTextRect(*AreaDataHnd);
  318.     HUnlock((Handle)AreaDataHnd);
  319.     InvalRect(&((*AreaDataHnd)->AreaRect));
  320. }
  321.  
  322.  
  323. //---------------------------------------------------------------------------------
  324. //
  325. // FUNCTION: CB_SetFlags
  326. //
  327. //---------------------------------------------------------------------------------
  328.  
  329. void CB_SetFlags(AreaHnd AreaDataHnd, SWORD CanFind, SWORD CanFill, SWORD CanList, SWORD CanEdit, SWORD ListOnActivate, SWORD ListOnKeystroke)
  330. {
  331.     (*AreaDataHnd)->Flags.CanFind = (CanFind != 0);
  332.     (*AreaDataHnd)->Flags.CanFill = (CanFill != 0);
  333.     (*AreaDataHnd)->Flags.CanList = ((CanList || ListOnActivate || ListOnKeystroke) != 0);
  334.     (*AreaDataHnd)->Flags.CanEdit = (CanEdit != 0);
  335.     (*AreaDataHnd)->Flags.ListOnActivate = (ListOnActivate != 0);
  336.     (*AreaDataHnd)->Flags.ListOnKeystroke = (ListOnKeystroke != 0);
  337.  
  338.  
  339. //---------------------------------------------------------------------------------
  340. //
  341. // FUNCTION: CB_FillLst
  342. //
  343. //---------------------------------------------------------------------------------
  344.  
  345. void CB_FillLst(AreaHnd AreaDataHnd, UBYTE* ListArrName)
  346. {
  347.     // For Windows compatibility, interprocess variables can
  348.     // start with '◊' (InterProcChar) or '<>'.
  349.     if((((SBYTE*)ListArrName)[1]) == InterProcChar)
  350.     {
  351.         (*AreaDataHnd)->Flags.InterprocArr = true;
  352.         (*AreaDataHnd)->ListArrName[0] = ListArrName[0]-1;
  353.         BlockMove(&(((SBYTE*)ListArrName)[2]),&(((SBYTE*)((*AreaDataHnd)->ListArrName))[1]),(*AreaDataHnd)->ListArrName[0]);
  354.     }
  355.     else if (((((SBYTE*)ListArrName)[1]) == '<') && (*((char*)ListArrName+2) == '>'))
  356.     {
  357.         (*AreaDataHnd)->Flags.InterprocArr = true;
  358.         (*AreaDataHnd)->ListArrName[0] = ListArrName[0]-2;
  359.         BlockMove(&(((SBYTE*)ListArrName)[3]),&(((SBYTE*)((*AreaDataHnd)->ListArrName))[1]),(*AreaDataHnd)->ListArrName[0]);
  360.     }
  361.     else
  362.     {
  363.         (*AreaDataHnd)->Flags.InterprocArr = false;
  364.         BlockMove(ListArrName,(*AreaDataHnd)->ListArrName,ListArrName[0]+1);
  365.     }    
  366.     CB_UpdateLst(AreaDataHnd);
  367. }
  368.  
  369.  
  370. //---------------------------------------------------------------------------------
  371. //
  372. // FUNCTION: CB_UpdateLst
  373. //
  374. //---------------------------------------------------------------------------------
  375.  
  376. void CB_UpdateLst(AreaHnd AreaDataHnd)
  377. {
  378.     HLock((Handle)AreaDataHnd);
  379.     ListSynchronize(*AreaDataHnd);
  380.     HUnlock((Handle)AreaDataHnd);
  381. }
  382.  
  383.  
  384. //---------------------------------------------------------------------------------
  385. //
  386. // FUNCTION: CB_SetLstPos
  387. //
  388. //---------------------------------------------------------------------------------
  389.  
  390. void CB_SetLstPos(AreaHnd AreaDataHnd, SWORD Position)
  391. {
  392.     SWORD                offset,len;
  393.     ListHandle    list;
  394.     TEHandle        text;
  395.     Cell                CurrCell;
  396.     Ptr                    TextPtr;
  397.     
  398.     CurrCell.v = 0;
  399.     CurrCell.h = 0;
  400.     list = (*AreaDataHnd)->ListHnd;
  401.     text = (*AreaDataHnd)->TextTEHnd;
  402.     while(LGetSelect(true, &CurrCell,list))
  403.         LSetSelect(false,CurrCell,list);
  404.     if ((Position>0) && (Position <=(*list)->dataBounds.bottom))
  405.     {
  406.         CurrCell.v = Position-1;
  407.         LSetSelect(true,CurrCell,list);
  408.         LAutoScroll(list);
  409.         LGetCellDataLocation(&offset,&len,CurrCell,list);
  410.         TextPtr = NewPtr(len+1);
  411.         if((*AreaDataHnd)->Flags.Active)
  412.             TEDeactivate(text);
  413.         LGetCell(TextPtr,&len,CurrCell,list);
  414.         TESetText(TextPtr, (long) len, text);
  415.         DisposePtr(TextPtr);
  416.         if((*AreaDataHnd)->Flags.Active)
  417.         {
  418.             TESetSelect(0,32767,text);
  419.             TEActivate(text);
  420.         }
  421.     }
  422.     else
  423.         TESetText(NULL,0,text); // wipe out the text if there's no element
  424.         
  425.     InvalRect(&(*AreaDataHnd)->AreaRect);
  426. }
  427.  
  428.  
  429. //---------------------------------------------------------------------------------
  430. //
  431. // FUNCTION: CB_GetLstPos
  432. //
  433. //---------------------------------------------------------------------------------
  434.  
  435. SLONG CB_GetLstPos(AreaHnd AreaDataHnd)
  436. {
  437.     Cell    CurrCell;
  438.     
  439.     CurrCell.v = 0;
  440.     CurrCell.h = 0;
  441.     
  442.     if(LGetSelect(true,&CurrCell,(*AreaDataHnd)->ListHnd))
  443.         return (SWORD)CurrCell.v+1;
  444.     else
  445.         return 0;
  446. }
  447.  
  448.  
  449. //---------------------------------------------------------------------------------
  450. //
  451. // FUNCTION: CB_SetTxt
  452. //
  453. //---------------------------------------------------------------------------------
  454.  
  455. void CB_SetTxt(AreaHnd AreaDataHnd, TextBlock* TextText)
  456. {
  457.     GrafPtr    savePort;
  458.     
  459.     if(TextText->fData != NULL)
  460.     {
  461.         HLock((Handle)(TextText->fData));
  462.         TESetText(*(TextText->fData), (long) TextText->fSize, (*AreaDataHnd)->TextTEHnd);
  463.         HUnlock((Handle)(TextText->fData));
  464.     }
  465.     else
  466.         TESetText(NULL,0,(*AreaDataHnd)->TextTEHnd);
  467.     if((*AreaDataHnd)->Flags.Active)
  468.         TESetSelect(0,32767,(*AreaDataHnd)->TextTEHnd);
  469.     GetPort(&savePort);
  470.     SetPort((*AreaDataHnd)->AreaGrafPort);
  471.     InvalRect(&(*AreaDataHnd)->AreaRect);
  472.     SetPort(savePort);
  473. }
  474.  
  475.  
  476. //---------------------------------------------------------------------------------
  477. //
  478. // FUNCTION: CB_GetTxt
  479. //
  480. //---------------------------------------------------------------------------------
  481.  
  482. void CB_GetTxt(AreaHnd AreaDataHnd, TextBlock* TextText)
  483. {
  484.     TextText->fSize = (*((*AreaDataHnd)->TextTEHnd))->teLength;
  485.     SetHandleSize(TextText->fData,TextText->fSize);
  486.     HLock((*((*AreaDataHnd)->TextTEHnd))->hText);
  487.     HLock(TextText->fData);
  488.     BlockMove(*((*((*AreaDataHnd)->TextTEHnd))->hText),*(TextText->fData),TextText->fSize);
  489.     HUnlock(TextText->fData);
  490.     HUnlock((*((*AreaDataHnd)->TextTEHnd))->hText);
  491. }
  492.  
  493.  
  494. //---------------------------------------------------------------------------------
  495. //
  496. // FUNCTION: CB_SetModified
  497. //
  498. //---------------------------------------------------------------------------------
  499.  
  500. void CB_SetModified(AreaHnd AreaDataHnd, SWORD Modified)
  501. {
  502.     (*AreaDataHnd)->Flags.Modified = (Modified != 0);
  503. }
  504.  
  505.  
  506. //---------------------------------------------------------------------------------
  507. //
  508. // FUNCTION: CB_GetModified
  509. //
  510. //---------------------------------------------------------------------------------
  511.  
  512. SLONG CB_GetModified(AreaHnd AreaDataHnd)
  513. {
  514.     if((*AreaDataHnd)->Flags.Modified)
  515.         return 1;
  516.     else
  517.         return 0;
  518. }
  519.  
  520.  
  521. //---------------------------------------------------------------------------------
  522. //
  523. // FUNCTION: CB_SetEnabled
  524. //
  525. //---------------------------------------------------------------------------------
  526.  
  527. void CB_SetEnabled(AreaHnd AreaDataHnd, SWORD Enabled)
  528. {
  529.     if ((SWORD)(*AreaDataHnd)->Flags.Enabled != Enabled)
  530.     {
  531.         (*AreaDataHnd)->Flags.Enabled = (Enabled != 0);
  532.         InvalRect(&((*AreaDataHnd)->AreaRect));
  533.     }
  534. }
  535.  
  536.  
  537. //---------------------------------------------------------------------------------
  538. //
  539. // FUNCTION: CB_GetEnabled
  540. //
  541. //---------------------------------------------------------------------------------
  542.  
  543. SLONG CB_GetEnabled(AreaHnd AreaDataHnd)
  544. {
  545.     if((*AreaDataHnd)->Flags.Enabled)
  546.         return 1;
  547.     else
  548.         return 0;
  549. }
  550.  
  551.  
  552. //---------------------------------------------------------------------------------
  553. //
  554. // FUNCTION: CB_SetHilite
  555. //
  556. //---------------------------------------------------------------------------------
  557.  
  558. void CB_SetHilite(AreaHnd AreaDataHnd, SWORD Start, SWORD End)
  559. {
  560.     TESetSelect((long)Start,(long)End,(*AreaDataHnd)->TextTEHnd);
  561.     InvalRect(&((*AreaDataHnd)->AreaRect));
  562. }
  563.  
  564.  
  565. //---------------------------------------------------------------------------------
  566. //
  567. // FUNCTION: CB_GetHilite
  568. //
  569. //---------------------------------------------------------------------------------
  570.  
  571. void CB_GetHilite(AreaHnd AreaDataHnd, SWORD* Start, SWORD* End)
  572. {
  573.     *Start = ((*((*AreaDataHnd)->TextTEHnd))->selStart);
  574.     *End = ((*((*AreaDataHnd)->TextTEHnd))->selEnd);
  575. }
  576.  
  577.  
  578. //---------------------------------------------------------------------------------
  579. //
  580. // FUNCTION: CB_GetFontNum
  581. //
  582. //---------------------------------------------------------------------------------
  583.  
  584. SLONG CB_GetFontNum(UBYTE* FontName)
  585. {
  586.     SWORD FontNum;
  587.     SLONG    LongFontNum;
  588.     GetFNum((ConstStr255Param) FontName,&FontNum);
  589.     LongFontNum = FontNum;
  590.     return (LongFontNum);
  591. }
  592.  
  593.  
  594. //---------------------------------------------------------------------------------
  595. //
  596. // FUNCTION: ListSynchronize
  597. //
  598. //---------------------------------------------------------------------------------
  599.  
  600. void ListSynchronize(AreaPtr AreaDataPtr)
  601. {
  602.     ValueBlock            ArrValBlock;
  603.     ParameterBlock    block;
  604.     SLONG                        ListElems,index;
  605.     ListHandle            List;
  606.     XHANDLE                    ArrDataHnd;
  607.     TextPtr                    ArrElemPtr;
  608.     Cell                        whichCell;
  609.     
  610.     block.fH = (XHANDLE)&ArrValBlock;
  611.     Pstrcpy(AreaDataPtr->ListArrName,block.fName);
  612.     if(AreaDataPtr->Flags.InterprocArr)
  613.     {
  614.         CALL4D(kEX_GET_GLOBALVAR,&block);
  615.     }
  616.     else
  617.         CALL4D(kEX_GET_VARIABLE,&block);
  618.                 
  619.     AreaDataPtr->ArrElems = ArrValBlock.uValue.fArray.fSize;
  620.     ArrDataHnd = ArrValBlock.uValue.fArray.fData;
  621.         
  622.     List = AreaDataPtr->ListHnd;
  623.     if(List)
  624.     {
  625.         ListElems = (*List)->dataBounds.bottom;
  626.         if(AreaDataPtr->ArrElems<ListElems)
  627.             LDelRow(ListElems-AreaDataPtr->ArrElems,1,List);
  628.         else if(AreaDataPtr->ArrElems>ListElems)
  629.             LAddRow(AreaDataPtr->ArrElems-ListElems,1,List);
  630.     
  631.         HLock((Handle)ArrDataHnd);
  632.         whichCell.h = 0;
  633.         for (index = 1; index<=AreaDataPtr->ArrElems; index++)
  634.         {
  635.             ArrElemPtr = NthTElemAdr(ArrDataHnd,index);
  636.             whichCell.v = index-1; // Cells are zero-relative
  637.             HLock((Handle)(ArrElemPtr->fData));
  638.             LSetCell(*(ArrElemPtr->fData),ArrElemPtr->fSize,whichCell,List);
  639.             if(MemError())
  640.                 SysBeep(10);
  641.             HUnlock((Handle)(ArrElemPtr->fData));
  642.         }
  643.         HUnlock((Handle)ArrDataHnd);
  644.     }
  645. }